export function chooseMedia(options = {}) {
	return new Promise((resolve, reject) => {
		wx.chooseMedia({
			...options,
			success(res) {
				resolve(res)
			},
			fail(err) {
				reject(err)
			}
		})
	})
}



export function getImageInfo(options = {}) {
	return new Promise((resolve, reject) => {
		wx.getImageInfo({
			...options,
			success(res) {
				resolve(res)
			},
			fail(err) {
				reject(err)
			}
		})
	})
}

export function canvasToTempFilePath(options = {}) {
	return new Promise((resolve, reject) => {
		wx.canvasToTempFilePath({
			...options,
			success(res) {
				resolve(res)
			},
			fail(err) {
				reject(err)
			}
		})
	})
}


export function chooseLocation(options = {}) {
	return new Promise((resolve, reject) => {
		wx.chooseLocation({
			...options,
			success(res) {
				resolve(res)
			},
			fail(err) {
				reject(err)
			}
		})
	})
}


export const getSelectQurey = (queryStr) => {
	return new Promise((resolve) => {
		const query = wx.createSelectorQuery();
		query
			.select(queryStr)
			.fields({
				id: true,
				node: true,
				size: true
			})
			.exec((res) => {
				resolve(res);
			});
	});
};